<?php
/**
 * Created by PhpStorm.
 * User: beekimlin
 * Date: 2020/3/26
 * Time: 13:41
 */

$client = new Swoole\Client(SWOOLE_SOCK_TCP);

if(!$client->connect('127.0.0.1', 9501, -1)) {
    exit("connect failed. Error: {$client->errCode}\n");
}


$client->send(mt_rand(1, 10000) . "hello world\n");

echo $client->recv();

$client->close();